package com.hg.library.model;

import android.os.Parcel;
import android.os.Parcelable;

import java.io.Serializable;
import java.util.Arrays;
import java.util.List;

/**
 * Created by ASUS-PC on 2016/8/16.
 */
public class UserInfoModel implements Parcelable,Serializable{
    private int msg;
    private String headhimgurl;
    private String nickname;
    private List<UserInfoModel> data;

    private byte[] imgBytes;

    public UserInfoModel(){}

    protected UserInfoModel(Parcel in) {
        msg = in.readInt();
        headhimgurl = in.readString();
        nickname = in.readString();
        data = in.createTypedArrayList(UserInfoModel.CREATOR);
    }

    public static final Creator<UserInfoModel> CREATOR = new Creator<UserInfoModel>() {
        @Override
        public UserInfoModel createFromParcel(Parcel in) {
            return new UserInfoModel(in);
        }

        @Override
        public UserInfoModel[] newArray(int size) {
            return new UserInfoModel[size];
        }
    };

    public int getMsg() {
        return msg;
    }

    public void setMsg(int msg) {
        this.msg = msg;
    }

    public String getHeadhimgurl() {
        return headhimgurl;
    }

    public void setHeadhimgurl(String headhimgurl) {
        this.headhimgurl = headhimgurl;
    }

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public List<UserInfoModel> getData() {
        return data;
    }

    public void setData(List<UserInfoModel> data) {
        this.data = data;
    }

    public byte[] getImgBytes() {
        return imgBytes;
    }

    public void setImgBytes(byte[] imgBytes) {
        this.imgBytes = imgBytes;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(msg);
        dest.writeString(headhimgurl);
        dest.writeString(nickname);
        dest.writeTypedList(data);
        dest.writeBlob(imgBytes);
    }

    @Override
    public String toString() {
        return "UserInfoModel{" +
                "msg=" + msg +
                ", headhimgurl='" + headhimgurl + '\'' +
                ", nickname='" + nickname + '\'' +
                ", data=" + data +
                ", imgBytes=" + Arrays.toString(imgBytes) +
                '}';
    }
}
